﻿<?php

class BenqsController extends AppController
{
    var $name = 'Benqs';

	function listmember()
    {
		$this->checkSession();
        $this->set('users', $this->User->findAll());
    }

	function view($id = null)
    {
		$this->checkSession();
        $this->User->id = $id;
        $this->set('user', $this->User->read());
    }

	function add()
    {
        if (!empty($this->data))
        {
			$someone = $this->Benq->findByName($this->data['Benq']['name']);
			if(empty($someone))
			{
				//Justin add
				if ($this->Benq->save($this->data))
				{
					$this->flash('报名信息已登记','/benqs');
				}
			}
			else
			{
				$this->flash('信息已登记','/benqs/add');
			}
        }
    }

}

?>
